package com.dream.song.springevent;

import com.dream.song.springevent.event.DemoEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author song_
 * @Date 2020/3/16
 * @desc
 **/

@RestController
public class TestController {

    @Autowired
    private EventSource eventSource ;

    @GetMapping(path = "/test")
    public String publish(){
        DemoEvent event = new DemoEvent(this,"这是一个测试event");
        eventSource.publish(event);
        return "success";
    }
}
